package com.ctshk.sapp.order.scenic.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.rpc.order.scenic.req.ScenicOrderReceiptAddReq;
import com.ctshk.rpc.order.scenic.req.ScenicOrderReceiptModifyReq;
import com.ctshk.rpc.order.scenic.service.IScenicOrderReceiptService;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.ctshk.common.web.support.BaseController;

/**
 * <p>
 * 景点门票订单-收据表 前端控制器
 * </p>
 *
 * @author 叶冠峰
 * @since 2021-03-25
 */
@RestController
@RequestMapping("/scenic-order-receipt")
public class ScenicOrderReceiptController extends BaseController {
    @DubboReference
    private IScenicOrderReceiptService scenicOrderReceiptService;

    @ApiOperation(value = "订单中心 - 新增收据", notes = "订单中心 - 新增收据(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.ADD, operTitle = "订单中心 - 新增收据", operDesc = "订单中心 - 新增收据")
    @PostMapping(value = "/add")
    public Result<Long> add(@RequestBody ScenicOrderReceiptAddReq scenicOrderReceiptAddReq){
        return scenicOrderReceiptService.add(scenicOrderReceiptAddReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "订单中心 - 修改收据", notes = "订单中心 - 修改收据(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.UPDATE, operTitle = "订单中心 - 修改收据", operDesc = "订单中心 - 修改收据")
    @PostMapping(value = "/modify")
    public Result<Long> modify(@RequestBody ScenicOrderReceiptModifyReq scenicOrderReceiptModifyReq){
        return scenicOrderReceiptService.modify(scenicOrderReceiptModifyReq,getCurrentUser(getRequest()));
    }
}
